Ternary 三元運算子


Posted by Rich on 2021-04-22

console.log(10 > 5 ? 'bigger' : 'smaller')
output:bigger

condition ? true : false
條件 ? true就執行 : false就執行


#note







Related Posts

何謂演算法技術面試?讀《Cracking the Coding Interview(提升程式設計師的面試力)》

何謂演算法技術面試?讀《Cracking the Coding Interview(提升程式設計師的面試力)》

[ 筆記 ] Express 03 - ORM & Sequelize

[ 筆記 ] Express 03 - ORM & Sequelize

來寫個氣象機器人吧!(Part 2)

來寫個氣象機器人吧!(Part 2)


Comments